/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("qx_bxgs",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Miyao.IServices;
using Orther.BLL.Miyao;
using Orther.Model.param;
using Project.Utils;
using VOL.Core.Filters;

namespace VOL.Miyao.Controllers
{
    public partial class qx_bxgsController
    {
        private readonly Iqx_bxgsService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        private BxgsBLL bxgsBLL = new BxgsBLL();

        [ActivatorUtilitiesConstructor]
        public qx_bxgsController(
            Iqx_bxgsService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }



        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetPageDataZjc")]
        public ActionResult GetPageDataZjc(BxgsParam param, Pagination pagination)
        {
            TData<List<qx_bxgs>> obj = bxgsBLL.GetPageList(param, pagination);
            return JsonNormal(obj);
        }


        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetObjectJson")]
        public async Task<ActionResult> GetObjectJson(BxgsParam param)
        {
            TData<qx_bxgs> obj = await bxgsBLL.GetObject(param);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Update)]
        [HttpPost, Route("SaveFormJson")]
        public async Task<ActionResult> SaveFormJson([FromBody] qx_bxgs entity)
        {
            TData obj = await bxgsBLL.SaveForm(entity);
            return JsonNormal(obj);
        }


        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Delete)]
        [HttpGet, Route("DeleteFromJson")]
        public async Task<ActionResult> DeleteFromJson(Guid id)
        {
            TData obj = await bxgsBLL.deleteFrom(id);
            return JsonNormal(obj);
        }




    }
}
